package model

type SysSql struct {
	DcModel
	SqlCode    string        `gorm:"comment:SQL编码;not null;unique;index;" json:"sql_code"`
	SqlType    string        `gorm:"comment:SQL类型;not null;index;" json:"sql_type"`
	SchemaName string        `gorm:"comment:Schema名称;" json:"schema_name"`
	TableName  string        `gorm:"comment:表名;" json:"table_name"`
	HasDayId   string        `gorm:"comment:是否有日期ID;" json:"has_day_id"`
	SqlString  string        `gorm:"type:text" json:"sql_string"`
	Sqlparam   []SysSqlparam `gorm:"many2many:sys_sql_sqlparam;foreignKey:SqlCode;joinForeignKey:SqlCode;references:SqlparamCode;joinReferences:SqlparamCode;" json:"sqlparam"`
	MenuCode   string        `json:"menu_code"`
}

type RequestGetSqlList struct {
	RequestPageAndSort
	SqlCode    string `json:"sql_code"`
	SqlType    string `json:"sql_type"`
	SchemaName string `json:"schema_name"`
	TableName  string `json:"table_name"`
	HasDayId   string `json:"has_day_id"`
	SqlString  string `json:"sql_string"`
	CreatedBy  string `json:"created_by"`
	UpdatedBy  string `json:"updated_by"`
	Memo       string `json:"memo"`
}

type RequestAddSql struct {
	RequestAdd
	SqlCode    string   `json:"sql_code"`
	SqlType    string   `json:"sql_type"`
	SchemaName string   `json:"schema_name"`
	TableName  string   `json:"table_name"`
	HasDayId   string   `json:"has_day_id"`
	SqlString  string   `json:"sql_string"`
	Sqlparam   []string `json:"sqlparam"`
}

type RequestValidateSql struct {
	SqlString string `json:"sql_string"`
}
type RequestValidatePreDefinedTable struct {
	SchemaName string `json:"schema_name"`
	TableName  string `json:"table_name"`
	HasDayId   string `json:"has_day_id"`
	SqlType    string `json:"sql_type"`
}

type RequestSqlSqlparamEdit struct {
	SqlCode     string               `json:"sql_code"`
	SqlSqlparam []RequestSqlSqlparam `json:"sql_sqlparam"`
}

type RequestSqlSqlparamEdit2 struct {
	SqlCode      string   `json:"sql_code"`
	SqlparamCode []string `json:"sqlparam_code"`
}

type RequestSqlSqlparam struct {
	SqlCode      string `json:"sql_code"`
	SqlparamCode string `json:"sqlparam_code"`
}

type ResponseJsonAgg struct {
	Jsonagg string `json:"jsonagg"`
}

type SqlColumn struct {
	ColumnName string `json:"column_name"`
	DataType   string `json:"data_type"`
}

type RequestSqlCode struct {
	SqlCode string `json:"sql_code"`
}
